package jielong

import (
	"time"
	"youdu/common/queue"
	daoLists "youdu/dao/jielong/lists"
)

var q *queue.QueueData

func NewID(id uint) {
	q.Push(id)
}
func UpdateUsersCount() {
	q = queue.NewQueue()
	for {
		// log.Printf("来自协程的消息-%d", q.Length())
		// 取出所有队列数据，循环输出到控制台
		for {
			item, ok := q.Pull()
			if !ok {
				break
			}
			// 执行更新
			daoLists.UpdateUsersCount(item, 0)
			// log.Printf("来自协程的队列数据-%d", item)
		}
		time.Sleep(time.Second * 5)
	}
}
